<template>
    <div>
        <van-row>
            <Hearders />
            <van-col span="4">
                <Left />
            </van-col>
            <van-col span="4">

                <table>
                    <tr v-for="i in work">
                        <td @click="tijiao(i.titles,1)">{{i.titles}}</td>
                    </tr>
                </table>
                
            </van-col>
            <van-col span="16">
                <p v-if="a == 1">
                    {{radio}}
                        姓名:{{title}} <br>
                        是否同意:
                        <van-radio-group v-model="radio">
                            <van-radio name="2"> 是</van-radio>
                            <van-radio name="1"> 否</van-radio>
                        </van-radio-group>
                        <br>
                        
                        <van-field label="审批意见:" placeholder="请输入" v-model="content"></van-field>
                        <van-button @click="add">提交</van-button>
                </p>
            </van-col>
        </van-row>
    </div>
</template>

<script>
import Hearders from '../comm/hearders'
import Left from '../comm/left.vue'
import axios from '../../http/axios'
    export default {
        components: { Hearders ,Left}, 
        data() {
            return {
                work:[],
                userid:localStorage.getItem('userid'),
                title:'',
                a:0,
                radio: '2',
                content:'',
            }
        },
        methods: {
            //提交
            add(){
                
                axios('/users/workdeal/','post',{"radio":this.radio,"content":this.content,'title':this.title,'userid':this.userid}).then(res=>{
                    
                })
            },
            //点击同意或否
            tijiao(h,j){
                this.title = h
                this.a=j
            },
            //获取任务
            getallwork(){
                axios('/users/workdeal/?userid='+this.userid,'get').then(res=>{
                    this.work = res.list
                })
            }
        },
        mounted() {
            this.getallwork()
        },
    }
</script>

<style scoped>

</style>